#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
#define endl "\n";

void solve(){
    int n;
    cin>>n;
    n++;
    ll x,y,z;
    cin>>x>>y>>z;
    vector<int>a(n);
    a[0]=0;
    vector<ll>cnt(n+5,0);
    vector<ll> si(n+5,0);
    vector<ll> mxn(n+5,0),mnn(n+5,0x3f3f3f3f);
    cnt[0]++;
    si[1]++;
    mnn[0]=0;
    ll mn=0;
    for(int i=1;i<n;i++){
        cin>>a[i];
        cnt[a[i]]++;
        si[cnt[a[i]]]++;
        mn=max(mn,cnt[a[i]]);
        if(a[i]>mxn[cnt[a[i]]])mxn[cnt[a[i]]]=a[i];
        if(a[i]<mnn[cnt[a[i]]])mnn[cnt[a[i]]]=a[i];
    }
    sort(a.begin(),a.end());
    ll sum=0;
    ll sum1=0;

    for(int i=1;i<n;i++){
        if(a[i]>a[i-1]){
            sum+=x;
        }
        else {
            sum+=y;
        }
    }

    int first=1;
    for(int i=1;i<=mn+2;i++){
        if(first){
            sum1+=x*(si[i]-1);
        }else{
            ll temp1=0;
            temp1+=x*(si[i]-1);
            if(mnn[i]>mxn[i-1]){
                temp1+=x;
            }else if(mnn[i]==mxn[i-1]){
                temp1+=y;
            }else if(mnn[i]<mxn[i-1]){
                temp1+=z;
            }
            ll temp2=y*si[i];
            sum1+=max(temp1,temp2);
        }
        // cout<<sum1<<' ';
        first=false;
    }
    // cout<<'\n';
    cout<<sum<<" "<<sum1<<endl;
    cout<<max(sum1,sum)<<endl;
}

//0 1 1 

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }

    return 0;
}